﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<UserControl 
	x:Class="Coding4Fun.Kinect.Wpf.Controls.HoverButton"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:Shapes="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing" 
	mc:Ignorable="d"     
	d:DesignHeight="100"
    d:DesignWidth="100"
	x:Name="UserControl">
	<UserControl.Resources>
		<Storyboard x:Key="uxSBHold">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shapes:Arc.EndAngle)" Storyboard.TargetName="uxRing" />
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="uxRing">
				<DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="uxSBPing">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="uxRing">
				<DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0" />
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="uxRing">
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="2">
					<EasingDoubleKeyFrame.EasingFunction>
						<CircleEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
				<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="uxRing">
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="2">
					<EasingDoubleKeyFrame.EasingFunction>
						<CircleEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
				<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shapes:Arc.EndAngle)" Storyboard.TargetName="uxRing">
				<DiscreteDoubleKeyFrame KeyTime="0" Value="360"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
	</UserControl.Resources>
	<Grid>
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="VisualStateGroup">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0"/>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="Normal"/>
				<VisualState x:Name="Checked">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="uxButtonImage">
							<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}"/>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="uxButtonActiveImage">
							<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
		<Grid x:Name="uxContentHolder">
			<Image x:Name="uxButtonImage" Stretch="Uniform"/>
			<Image x:Name="uxButtonActiveImage" Stretch="Uniform" Visibility="Hidden"/>
		</Grid>

		<Shapes:Arc Name="uxRing" StartAngle="0" EndAngle="0" Stroke="White" StrokeThickness="5" Stretch="None" RenderTransformOrigin="0.5,0.5">
			<Shapes:Arc.RenderTransform>
				<ScaleTransform/>
			</Shapes:Arc.RenderTransform>
		</Shapes:Arc>

	</Grid>
</UserControl>
